﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FutureOpen.Core;
using FutureOpen.Core.func;
using FutureOpen.Core.func.db;
using System.Collections.Generic;
using FutureOpen.Web.Pages;
public partial class OrgMyList : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {        
        base.PageInit();
        
        if (!IsPostBack)
        {
            if (IsLogin())
            {
                MyOrg ObjMyOrg = new MyOrg();
                int Count = ObjMyOrg.GetOrgCountByUsrID(this.MyUsr);
                AspNetPager1.RecordCount =Count;
                if (Count > 0) BindOrgList(0, 10);
                else this.AspNetPager1.Visible = false;
            }
            else
            {
                this.DataList1.Visible = false;
                this.AspNetPager1.Visible = false;
            }
        }
    }
    private void BindOrgList(int start, int count)
    {
        if (this.AspNetPager1.Visible == false) this.AspNetPager1.Visible = true;
        if (DataList1.Visible == false) DataList1.Visible = true;
        MyOrg ObjMyOrg = new MyOrg();
        IList<Org> orgList = ObjMyOrg.GetOrgListByUsrID(this.MyUsr, start, count);
        DataList1.DataSource = orgList;
        DataList1.DataBind();
    }
    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        BindOrgList((AspNetPager1.CurrentPageIndex - 1) * 10, 10);
    }
}
